/**
 *
 *
 *
 */
import * as CONSTANT from '../config/constant'
import router from "../router";

const utils = {
  getDefaultRegisterForm() {
    return {
      username: '',
      password: '',
      gender: CONSTANT.MALE,
      birthday: '2000-01-01',
      email: '',
      phone: '',
      provinceCityArea: ['广东省', '江门市', '蓬江区'],
      province: '广东省',
      city: '江门市',
      area: '蓬江区',
      address: '',
      isAvailable:
      CONSTANT.USER_VALID,
      role:
      CONSTANT.ROLE_USER,
      avatar: ''
    }
  },
  setTitle(title) {
    title = (title ? title + ' | ' : '') + CONSTANT.BASE_TITLE
    document.title = title
  },
  isObjectEmpty(obj) {
    if (!obj) return true
    return Object.keys(obj).length === 0
  }
}
utils.install = Vue => {
  Vue.prototype.$utils = utils
}
export default utils
